package main

import (
	"io"
	"os"
	"strings"
)

type rot13Reader struct {
	r io.Reader
}

//其实我用映射也可以 不过比较麻烦 得全部打一遍
func rot(out byte) byte {
	switch {
	case out >= 'A' && out <= 'M' || out >= 'a' && out <= 'm':
		out += 13
	case out >= 'N' && out <= 'Z' || out >= 'n' && out <= 'z':
		out -= 13
	}

	return out
}
func (rot13 rot13Reader) Read(data []byte) (readed int, err error) {
	n, e := rot13.r.Read(data)
	for i := 0; i < n; i++ {
		data[i] = rot(data[i])
	}
	return n, e
}

func main() {
	s := strings.NewReader("Lbh penpxrq gur pbqr!")
	r := rot13Reader{s}
	io.Copy(os.Stdout, &r)
}
